<title>留言板</title>
<link rel="icon" href="./../img/logo.png">
<head>
<style>
	body{
		margin: 0;
	}
	a{
		color: #000000;
		text-decoration: none;
	}
	.home{
		margin: 0 auto;
		background-color: #fff;
		width: 1345px;
		height: 1320px;
		position: absolute;
	}
	.liuyan{
		margin: 0 auto;
		width: 1345px;
		height: 648px;
		background-image: url(../img/zhuce.jpg);
		position: absolute;
	}
	.f .i1{
		height: 45px;
		width: 300px;
		margin-top: 180px;
		
		background-color: #4E495D;
		  border-radius: 8px;
		  margin-bottom: 20px;
		  padding: 0 16px;
		  font-size: 18px;
		  color: #c4c3ca;
		  font-weight: 500;
		  outline: none;
		  border: none;
		  box-shadow: 0 4px 8px 0 rgba(78, 73, 79, .5);
		  transform-style: preserve-3d;
		  transform: translate3d(0, 0, 1px);
	}
	.f .i2{
		height: 45px;
		width: 300px;
		background-color: #4E495D;
		  border-radius: 8px;
		  margin-bottom: 20px;
		  padding: 0 16px;
		  font-size: 18px;
		  color: #c4c3ca;
		  font-weight: 500;
		  outline: none;
		  border: none;
		  box-shadow: 0 4px 8px 0 rgba(78, 73, 79, .5);
		  transform-style: preserve-3d;
		  transform: translate3d(0, 0, 1px);
	}
	.f .i3{
		height: 150px;
		width: 300px;
		
		background-color: #4E495D;
		  border-radius: 8px;
		  margin-bottom: 20px;
		  padding: 0 16px;
		  font-size: 18px;
		  color: #c4c3ca;
		  font-weight: 500;
		  outline: none;
		  border: none;
		  box-shadow: 0 4px 8px 0 rgba(78, 73, 79, .5);
		  transform-style: preserve-3d;
		  transform: translate3d(0, 0, 1px);
	}
	.f{
		width: 250px;
		height: 375px;
		margin-left: 800px;
	}
	.an{
		width: 235px;
		height: 50px;
		background-image: url(../img/kong.jpg);
		margin-top: -5px;
		border: 0;
	}
	.container{
		width: 100px;
		height: 100px;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		text-align: center;
		margin-top: -10px;
		margin-left: 100px;
	}
	#rec{
		fill:transparent;
		stroke:tomato;
		stroke-width: 12px;
		stroke-dasharray: 100 500;
		stroke-dashoffset: 230;
	}
	.btn{
		position: relative;
		width: 240px;
		height: 60px;
	}
	.nav{
		font-size: 23px;
		position: relative;
		top:-50px;
		letter-spacing: 6px;
	}
	@keyframes move{
		to{
			stroke-width: 4px;
			stroke-dasharray: 600;
			stroke-dashoffset: 0;
		}
	}
	.btn:hover #rec{
		animation: move 0.8s linear forwards;
	}
	
	.ban{
		width: 800px;
		height: 648px;
		margin: auto auto;
		
	}
	.tui{
		font-size: 20px;
		color: rgb(36,75,116);
	}
</style>
</head>
<body>
<div class="home">
    
	<div class="liuyan">
<div>
		<a href="./../Login/logout.php" class="tui">注销</a>
	</div>
<form action="" method="post" class="f">
	<input type="text" name="usename" class="i1" placeholder="用户名"><br/><br/>
	<input type="text" name="email" class="i2" placeholder="email"><br/><br/>
	<textarea name="content" class="i3" placeholder="留言板"></textarea><br/><br/>
	<div class="container">
		<div class="btn">
			<svg width="240" height="60">
				<rect width="240" height="60" id="rec"/>
			</svg>
			<div class="nav">
				<input type="submit" name="post" value="发布" class="an">
			</div>
		</div>
	</div>
</form>
	</div>
	<br/><br/><br/><br/>
	<br/><br/><br/><br/>
	<br/><br/><br/><br/>
	<br/><br/><br/><br/>
	<br/><br/><br/><br/>
	<br/><br/><br/><br/>
	<br/><br/><br/><br/>
	<br/><br/><br/><br/>
	<div class="ban">
<?php
	/*include('conn.php');*/
	if(isset($_POST['post'])){
		$conn=mysqli_connect("localhost","root","10a5c81626ac5ee2","message") or die("数据库链接失败！");
		$sql="insert into `message` (`id`,`usename`,`email`,`content`,`time`) 
		values('','$_POST[usename]','$_POST[email]','$_POST[content]',now())";
		$result=mysqli_query($conn,$sql);
		if($result){
			
?>
			<p>发布成功</p>
<?php
		}else{
			echo "发布失败";
		}
	}
?>
<?php
	$conn=mysqli_connect("localhost","root","10a5c81626ac5ee2","message") or die("数据库链接失败！");
	$sql="select * from message order by id desc";
	$query=mysqli_query($conn,$sql);
	$nums=mysqli_num_rows($query);//mysql_num_rows() expects parameter 1 to be resource, boolean given
	if($nums!=0){
		while($rs=mysqli_fetch_array($query)){
?>
	
	<table cellspacing="1" border="1" align="center" width="800" >
		<tr >
			<td width="400px">&nbsp;&nbsp;用户名:<?php echo $rs['usename']."<br/>"; ?> </td>
			<td width="400px">&nbsp;&nbsp;E - mail:<?php echo$rs['email']."<br/>"; ?> </td>
		</tr>
		<tr >
			<td  colspan="2">&nbsp;&nbsp;留言内容:<?php echo $rs['content']."<br/><br/>"; ?> </td>
		</tr>
		<tr >
			<td align="center">
				<a href="reply.php?id=<?php echo $rs['id'];?>">回复留言</a>
			</td>
			<td align="center">
				<a href="delete.php?id=<?php echo $rs['id'];?>">删除留言</a>
			</td>
		</tr>
		<br />
	</table>
<?php
		}
	}else{
		echo "还没有留言哦~";
?>
<?php
	}
		
?>
	</div>
</div>
</body>